<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>用户列表</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
<style type="text/css">
   .disPage{
   text-decoration:none; 
   
   }

</style>


<script type="text/javascript">
	  function delUser(id){
	  var flag = confirm("确定删除吗？");
	  if(flag==true){
	  var url  ="user?flag=delUser&userId="+id;
	  location.href = url;
	 // alert(id);
	  }
	 }
</script>

</head>

<body>
<br/><br/><br/>
	<table border="1" width="800px" height="50px" align="center">
		<tr align="center">
			<td>用户编号</td>
			<td>用户名号</td>
			<td>年龄</td>
			<td>性别</td>
			<td>密码</td>
			<td>身高</td>
			<td>生日</td>
			<td>操作</td>
		</tr>
		<c:forEach var="user" items="${userList}" varStatus="status">
			<tr align="center"
				<c:if  test="${status.index % 2 == 0 }">
           style="background:#B0C4DE"
         </c:if>>
				<td>${user.userId}</td>
				<td>${user.userName}</td>
				<td>${user.age}</td>
				<td>${user.gender}</td>
				<td>${user.password}</td>
				<td>${user.height}</td>
				<td>${user.birthday}</td>
				<td><a style="text-decoration:none" href="user?flag=userList&userId=${user.userId }">修改</a>&nbsp;&nbsp;&nbsp;
					<a style="text-decoration:none" href="javascript:void(0)" onclick="delUser(${user.userId })">删除</a>
					<!-- a 标签的隐藏      javascript:void(0)--></td>
			</tr>

		</c:forEach>
		
          <tr align="center" >
              
			<td colspan="8"  class="disPage">
			当前页数:[${page.currPage }/${page.totalPage}]&nbsp;
		
			<a  style="text-decoration:none"  href="user?flag=userList&currPage=1">首页</a>&nbsp;
	
			<c:if test="${page.currPage>1 }">
			<a  style="text-decoration:none"   href="user?flag=userList&currPage=${page.currPage-1}">上一页</a>&nbsp;
			</c:if>
			
			<c:if test="${page.currPage != page.totalPage }">
			<a  style="text-decoration:none"  href="user?flag=userList&currPage=${page.currPage+1 }">下一页</a>&nbsp;
			</c:if>
			<a  style="text-decoration:none"  href="user?flag=userList&currPage=${page.totalPage }">末页</a>&nbsp;
		
			</td>
			
		</tr>
        



	</table>
</body>
</html>
